This is a document to highlight the steps involved conducting self organizing map analysis with data from the MRTA Projects.
Data are restricted acces and are not included in the repository
For more infomration please email : x.quek@garvan.org.au
library(edgeR)
## Loading required package: limma
library(pheatmap)
library(cluster)
library(R6)
library(reshape2)
library(plyr)
library(kohonen)
## Loading required package: class
## Loading required package: MASS
library(ggplot2)
source('src/somHelper.R')
snail_model_fpkm <- fpkm[classifications$snailModel == 'S']
snail_model_fpkm <- snail_model_fpkm[rowSums(snail_model_fpkm > 1 ) >= ncol(snail_model_fpkm),]
snail_model_fpkm_list <- list()
snail_model_fpkm_list$fpkm <- snail_model_fpkm
snail_model_fpkm_list$fpkm_scaled <- apply(snail_model_fpkm, 2, scale, center = T)
snail_model_fpkm_list$fpkm_scaled <- as.data.frame(snail_model_fpkm_list$fpkm_scaled,row.names = rownames(snail_model_fpkm))
snail_model_fpkm_list$fpkm_log10 <- log10(snail_model_fpkm + 0.25 )
snail_model_fpkm_list$fpkm_scaled_log10 <- apply(snail_model_fpkm_list$fpkm_log10 , 2, scale, center = T)
snail_model_fpkm_list$fpkm_scaled_log10 <- as.data.frame(snail_model_fpkm_list$fpkm_scaled_log10,row.names = rownames(snail_model_fpkm))
snail_model_fpkm_som_list <- lapply(snail_model_fpkm_list, function(x)
{ set.seed(7);
som(data=as.matrix(x), grid = somgrid(8,8, "rectangular"), keep.data =T)
})
snail_model_fpkm_somObj_list <- lapply(snail_model_fpkm_som_list, function(x){
somHelper$new(x)
})
fpkm_som_plots <- somPlotHelper$new(snail_model_fpkm_somObj_list)
fpkm_som_plots$plotAllCluster()
## Using cluster as id variables
## Using cluster as id variables
## Using cluster as id variables
## Using cluster as id variables
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.